import Vue from 'vue'
import VueRouter from 'vue-router'
import IndexView from '../views/index/indexView.vue'
import SearchView from '../views/search/searchView.vue'
import UserCenterView from '../views/userCenter/userCenter.vue'
import CartView from '../views/cart/cartView.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: IndexView
  },
  
    {
      path: '/detail/:id', // 动态路由，根据id动态加载不同的详情页
      name: 'details',
      component: () => import('@/views/details/detailsView.vue')
    },
    {
      path: '/search',
      name: 'CourseSearch',
      component: SearchView
    },
    {
      path: '/userCenter',
      name: 'UserCenter',
      component: UserCenterView
    },
    {
      path: '/cart',
      name: 'Cart',
      component: CartView
    }
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})




export default router
